package com.wkbb.basic.thread;

import com.wkbb.basic.feign.DoorFeignService;
import com.wkbb.basic.service.StudentService;
import com.wkbb.common.enums.ChangeClassOperateTypeEnum;
import lombok.extern.slf4j.Slf4j;

/**
 * 换班操作异步处理
 * */
@Slf4j
public class ChangeClassSyncDataTask implements Runnable {

    private Integer operateType;
    private DoorFeignService doorFeignService;
    private Long orgId;
    private Long gradeId;
    private String gradeName;
    private Long classId;
    private String className;
    private Long userId;
    private String operateUser;

    public ChangeClassSyncDataTask(Integer operateType,DoorFeignService doorFeignService,Long orgId,Long gradeId,String gradeName,Long classId,String className,Long userId,String operateUser) {
        this.operateType = operateType;
        this.doorFeignService = doorFeignService;
        this.orgId = orgId;
        this.gradeId = gradeId;
        this.gradeName = gradeName;
        this.classId = classId;
        this.className = className;
        this.userId = userId;
        this.operateUser = operateUser;
    }

    @Override
    public void run() {
        try {
            log.info("进入换班升班操作异步处理门禁动态数据开始.....start，orgId:{}，gradeId:{} classId:{},userId:{}",orgId,gradeId,classId,userId);
            if(operateType == ChangeClassOperateTypeEnum.CHANGE_CLASS_TO_STUDENT_PERSON.getCode().intValue()) {

            }
            else if(operateType == ChangeClassOperateTypeEnum.CHANGE_CLASS_TO_UP_CLASS.getCode().intValue())
            {
                doorFeignService.syncChangeClassData(operateType,orgId,gradeId,gradeName,classId,className,userId,operateUser);
            }
            log.info("进入换班升班操作异步处理门禁动态数据结束.....");
        } catch (Exception e) {
            log.error("换班操作异步处理，{}", e);
            e.printStackTrace();
        }

    }

}
